<#import "/macro.ftl" as m>
<@m.page_header title='推广' />
<div id="page-content-wrapper">
    <div id="page-title">
        <h3>推广</h3>
        <p class="font-red mrg10T">复制广告投放URL，进行广告投放。投放前先用浏览器访问广告投放URL，验证URL地址是否正确。<p>
        <div id="breadcrumb-right">
            <div class="float-right">
                <a href="/popularizes/add" class="btn medium primary-bg">
                    <span class="button-content">添加推广</span>
                </a>
            </div>
        </div>
    </div>
    <div id="page-content">
    	<form id="form" action="/popularizes" method="get">
    		<div class="form-row">
    			<div class="form-input col-md-6">
    				<input placeholder="填写推广名称查询" type="text" name="name" id="name" value="${name}">
    			</div>
    			<div class="form-checkbox-radio col-md-2">
    				<div class="checker">
    					<span class="ui-state-default btn radius-all-4">
    						<input type="checkbox" class="custom-checkbox" name="isAllPopularizing" id="isAllPopularizing" <#if isAllPopularizing>checked</#if> onclick="$('#form').trigger('submit');">
    						<i class="glyph-icon icon-ok"></i>
    					</span>
    				</div>
    				<label for="isAllPopularizing">所有推广</label>
    			</div>
    			<div class="form-input col-md-2">
		        	<a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" title="Validate!" onclick="$('#form').trigger('submit');">
			            <span class="button-content">
			                查询
			            </span>
	                </a>
		        </div>
    		</div>
    	</form>
    	<table class="table">
	        <thead>
	            <tr>
	                <th>名称<br />类别</th>
	                <th>最新编辑者<br />最新编辑时间</th>
	                <th>广告投放URL<br />推广网站URL</th>
	                <th>停止推广</th>
	                <th>操作</th>
	            </tr>
	        </thead>
	        <tbody>
	        	<#list popularizes.list as popularize>
					<tr id="${popularize.id}">
		                <td>
		                	<p>${popularize.name}</p>
		                	<p class="mrg10T">${popularize.category.name} - ${popularize.category.bigger.name}</p>
		                </td>
		                <td>
		                	<p>${popularize.editor}</p>
		                	<p class="mrg10T">${(popularize.modifyDate?string('yyyy-MM-dd HH:mm:ss'))!''}</p>
		                </td>
		                <td>
		                	<div class="form-row">
				                <div class="form-input col-md-10">
				                    <input placeholder="" type="text" id="name" name="name" value="${popularizeRootUrl}${popularize.adPathUrl}" data-required="true" data-rangelength="[1,45]">
				                </div>
				                <div class="form-input col-md-2">
				                    <span>
								   		<object style="vertical-align:middle;" allowscriptaccess="always" type="application/x-shockwave-flash" width="14" height="14" data="/assets/flash/clippy.swf" flashvars="text=${popularizeRootUrl}${popularize.adPathUrl}" title="复制到剪贴板">
											<param name="quality" value="high">
											<param name="bgcolor" value="#ffffff">
											<param name="scale" value="noscale">
											<param name="wmode" value="transparent">
											<param name="flashvars" value="text=${popularizeRootUrl}${popularize.adPathUrl}">
											<embed type="application/x-shockwave-flash" quality="high" bgcolor="#ffffff" scale="noscale" wmode="transparent" flashvars="text=${popularizeRootUrl}${popularize.adPathUrl}" width="14" height="14">
										</object>
									</span>
									复制
				                </div>
					        </div>
		                	<#if popularize.url?length &gt; 50>
		                		<#assign url = popularize.url?substring(0,50)  + "...">
		                	<#else>
		                		<#assign url = popularize.url?substring(0,popularize.url?length)>
		                	</#if>
		                	<div>${popularize.url}</div>
		                </td>
		                <td>${popularize.isStopPopularize?string("是","否")}</td>
		                <td>
		                    <div class="dropdown">
                                <a href="javascript:;" title="" class="btn medium bg-blue" data-toggle="dropdown">
                                    <span class="button-content">
                                        <i class="glyph-icon font-size-11 icon-cog"></i>
                                        <i class="glyph-icon font-size-11 icon-chevron-down"></i>
                                    </span>
                                </a>
                                <ul class="dropdown-menu float-right">
									<li>
                                        <a href="/channels/analyse?popularizeId=${popularize.id}" title="">
                                            <i class="glyph-icon icon-stethoscope mrg5R"></i>
                                            分析
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/popularizes/${popularize.id}/edit" title="">
                                            <i class="glyph-icon icon-edit mrg5R"></i>
                                            编辑
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/popularizes/${popularize.id}" title="">
                                            <i class="glyph-icon icon-file-text-alt mrg5R"></i>
                                            详情
                                        </a>
                                    </li>
                                </ul>
                            </div>
		                </td>
		            </tr>
				</#list>    
	    	</tbody>
	    </table>
	    <div class="button-group center-div">
	    	${pagerHelper.content}
	    </div>
    </div>
</div>